package com.vcourse.service.edu.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vcourse.service.base.dto.CourseDto;
import com.vcourse.service.edu.entity.Course;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vcourse.service.edu.vo.CoursePublishVo;
import com.vcourse.service.edu.vo.CourseVo;
import com.vcourse.service.edu.vo.WebCourseVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 课程 Mapper 接口
 * </p>
 *
 * @author Zengsh123
 * @since 2020-05-25
 */
@Mapper
public interface CourseMapper extends BaseMapper<Course> {
    /**
     * 自定义分页查询
     *
     * @param courseVoPage page对象，MP自动引入
     * @param queryWrapper 条件查询对象
     * @return 分页集合
     */
    List<CourseVo> selectCourseVoPage(Page<CourseVo> courseVoPage,
                                      @Param(Constants.WRAPPER)
                                              QueryWrapper<Course> queryWrapper);

    /**
     * 联表查询课程发布信息
     *
     * @param id 课程Id
     * @return 发布信息
     */
    CoursePublishVo getCoursePublishVoById(@Param("id") String id);

    /**
     * 查询课程请求
     * @param courseId 课程id
     * @return 课程详情
     */
    WebCourseVo selectWebCourseVoById(@Param("courseId") String courseId);

    /**
     * 查询课程信息
     * @param courseId 课程id
     * @return 信息
     */
    CourseDto getCourseDtoById(@Param("courseId") String courseId);
}
